//
//  KWallProfileCell.m
//  Keping
//
//  Created by apple on 2017/12/8.
//  Copyright © 2017年 柯平. All rights reserved.
//

#import "KWallProfileCell.h"

@interface KWallProfileCell()

@property (nonatomic, weak) IBOutlet UIImageView *avatarView;
@property (nonatomic, weak) IBOutlet UIImageView *dynamicImg;
@property (nonatomic, weak) IBOutlet UIImageView *dynamicImgLike;
@property (nonatomic, weak) IBOutlet UILabel *nickName;
@property (nonatomic, weak) IBOutlet UILabel *dynamicMsg;
@property (nonatomic, weak) IBOutlet UILabel *dynamicComment;
@property (nonatomic, weak) IBOutlet UILabel *dynamicTime;

@end

@implementation KWallProfileCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setStatusLayout:(KStatusLayout *)statusLayout {
    if (!statusLayout) {
        return;
    }
    
    _statusLayout = statusLayout;
    [self.avatarView sd_setImageWithURL:[NSURL URLWithString:[KGetImageURL stringByAppendingString:statusLayout.status.profile]] placeholderImage:nil];
    if (statusLayout.status.imageUrls.count == 0) {
        self.dynamicImg.hidden = YES;
        self.dynamicMsg.text = statusLayout.status.subject;
    } else {
        self.dynamicImg.hidden = NO;
        self.dynamicMsg.hidden = YES;
        [self.dynamicImg sd_setImageWithURL:[NSURL URLWithString:[KGetImageURL stringByAppendingString:statusLayout.status.imageUrls.firstObject]] placeholderImage:nil];
    }
    
    if (statusLayout.status.isLike) {
        self.dynamicComment.hidden = YES;
        self.dynamicImgLike.hidden = NO;
        self.nickName.text = [NSString stringWithFormat:@"%@ liked your post.",statusLayout.status.realName];
    } else {
        self.dynamicComment.hidden = NO;
        self.dynamicComment.hidden = YES;
        self.dynamicComment.text = statusLayout.status.subject;
        self.nickName.text = statusLayout.status.realName;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
